using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PatOeMap : EntityTypeConfiguration<SO_PatOe>
    {
        public SO_PatOeMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Bill_Currency, t.Bill_Date, t.Total, t.vglbatch });

            // Properties
            this.Property(t => t.PatientID)
                .HasMaxLength(6);

            this.Property(t => t.PatientName)
                .HasMaxLength(110);

            this.Property(t => t.Bill_Currency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.doctor)
                .HasMaxLength(50);

            this.Property(t => t.Document__)
                .HasMaxLength(10);

            this.Property(t => t.PAYTYPE)
                .HasMaxLength(20);

            this.Property(t => t.vglbatch)
                .IsRequired()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("SO_PatOe");
            this.Property(t => t.PatientID).HasColumnName("PatientID");
            this.Property(t => t.voucher).HasColumnName("voucher");
            this.Property(t => t.PatientName).HasColumnName("PatientName");
            this.Property(t => t.PAT_CURRENCY).HasColumnName("PAT_CURRENCY");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Bill_Currency).HasColumnName("Bill_Currency");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.Bill_Date).HasColumnName("Bill_Date");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.doctor).HasColumnName("doctor");
            this.Property(t => t.closedout).HasColumnName("closedout");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.PAYTYPE).HasColumnName("PAYTYPE");
            this.Property(t => t.related_bill_of_payment).HasColumnName("related_bill_of_payment");
            this.Property(t => t.vglbatch).HasColumnName("vglbatch");
        }
    }
}
